{% extends "base.html" %}

{%block title%}Kartotečni list{% endblock %}

{% block content %}


{% if only_search %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/search.js"></script>
<script type="text/javascript">

$(document).ready(function(){    
    search_setcb('student',function(student){
      url = '/exams/card_index/'+student.pk+'/';
      document.location = url;
    });
    
});
</script>
 {% include "snippets/student/search.htm" %}
 
{% else %}

{% if step == 0%}

<p>Izberi parametre prikaza</p>
<form method="post">
{% csrf_token %}
	{{cardListSelection.as_p}}
<input name="step" type="hidden" value="{{step_next}}" />
<input type="submit" value="Prikaži" />
</form>
{% else %}

{% include "snippets/core/print.htm" %}

<h2>Prikaz za študenta {{ student.enrollment_number }} - {{ student }}</h2>
{% for e in data%}
<table class="info" style="width: 90%;">
  <tr>
    <td><b>Študijsko leto:</b></td>
    <td>{{ e.e.academic_year }}</td>
    <td><b>Program:</b></td>
    <td>{{ e.e.student_program }}</td>
  </tr>
  <tr>
    <td><b>Letnik:</b></td>
    <td>{{ e.e.student_year }}</td>
    <td><b>Vrsta vpisa:</b></td>
    <td>{{ e.e.get_enrollment_type_display }}</td>
  </tr>
  <tr>
    <td><b>Način:</b></td>
    <td>{{ e.e.get_full_time_student_display }}</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

<table class="list" style="width: 90%">
  <tr>
    <th class="num">#</th>
    <th>Šifra</th>
    <th>Predmet</th>
    <th>KT/U</th>
    <th>Predavatelj(i)</th>
    <th>Datum</th>
    <th>Ocena</th>
    <th>Št. polaganj</th>
  </tr>
 {% for s in e.subjects %}
  <tr>
      <td class="num">{{ forloop.counter }}</td>
      <td>{{ s.sp.subject.subject.code }}</td>
      <td>{{ s.sp.subject.subject.name }}</td>
      <td>{{ s.sp.subject.subject.credit_points }}</td>
      {% if s.apps|length > 0 %}
        {% for a in s.apps %}
          {% if not forloop.first %}
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          {% endif %}        
          <td>{{ a.exam.show_professor }}</td>
          <td>{{ a.exam.date }}</td>
          <td>{% if a.exam_grade == 0 or a.practice_grade == 0 %}VP{% else %}{% if a.exam_grade or a.practice_grade %}{% if a.exam.rating_type == 'OC1' %}{{ a.exam_grade }}/{{ a.practice_grade }}{% endif %}{% if a.exam.rating_type == 'OC2' %}{{ a.practice_grade }}{% endif %}{% if a.exam.rating_type == 'OC3' or a.exam.rating_type == None %}{{ a.exam_grade }}{% endif%}{% else %}Na/Na{% endif %}{% endif %}</td>
          <td>{{ a.try_ }} - {{ a.count_year }}</td>
        {% endfor %}
      {% endif %}
  </tr>
  {% endfor %} 
</table>
<table class="info" style="width: 90%">
  <tr>
    <td><b>Povprečje izpitov</b></td>
    <td>{% if e.avg_wgrade != None %}{{ e.avg_wgrade }}{% else %}/{% endif %}</td>
    <td><b>Povprečje vaj</b></td>
    <td>{% if e.avg_ograde != None %}{{ e.avg_ograde }}{% else %}/{% endif %}</td>
  </tr>
  {% if e.avg_grade != None %}
  <tr>
    <td><b>Skupno povprečje ocen</b></td>
    <td>{{ e.avg_grade }}</td>
  </tr>
  {% endif %}
  <tr>
    <td><b>Skupno število kreditnih točk/ur:</b></td>
    <td colspan="2">{{ e.credit_points }} od {{ e.all_credit_points }}</td>     
  </tr>
</table>
<br /><br />
{% endfor%}

{% endif %}

{% endif %}


{% endblock %}>
